WEBVTT

00:00.950 --> 00:08.030
And this video we're creating another variant of the S&amp;P 500 return triangle and I call this the return

00:08.030 --> 00:12.440
radar because it pretty much looks like a weather radar.

00:12.440 --> 00:18.800
The only difference to the return triangles that the return rate US based on weekly returns instead

00:18.800 --> 00:20.530
of annual returns.

00:20.600 --> 00:27.050
And that means that we have a higher resolution a definition here and that might give us some more insight

00:27.650 --> 00:31.230
and the code to pretty much looks the same.

00:31.250 --> 00:39.140
So I will only highlight the differences and first of all we import the necessary libraries here and

00:39.140 --> 00:40.870
we also import our data

00:44.670 --> 00:49.050
so here we are for the S&amp;P 500 price data.

00:49.140 --> 00:51.450
And now comes the very first difference.

00:51.750 --> 00:55.440
So we read sample the S&amp;P 500 price data.

00:55.740 --> 01:02.520
And before we read sample to emulate frequency and here we read sample to weekly frequency and we take

01:02.520 --> 01:11.690
the very last trading price of each week so that's the weekly data frame and then in the next step we

01:11.690 --> 01:13.500
calculate weekly or lock return.

01:13.510 --> 01:15.500
So that's what we are doing here.

01:15.500 --> 01:21.530
And we actually annualize the weekly returns by multiplying with fifty two.

01:22.250 --> 01:25.510
And by doing so we're creating a new column return.

01:25.850 --> 01:28.670
And we also drop the very first row.

01:29.000 --> 01:30.840
So let's have a look.

01:31.070 --> 01:36.440
So here we have the weekly closing prices and the weekly returns the annualized

01:39.820 --> 01:45.430
and in total our period includes one thousand five hundred sixty five weeks.

01:45.610 --> 01:52.930
And uh that means uh that in our next step we are creating one thousand five hundred sixty five new

01:52.930 --> 01:57.280
columns and actually each column stands for a rolling statistic.

01:57.640 --> 02:04.630
So we have for the rolling mean return for a period of one week two weeks three weeks until one thousand

02:04.630 --> 02:07.180
five hundred sixty five weeks.

02:07.330 --> 02:09.450
And therefore we created our list.

02:09.460 --> 02:23.920
Windows so here we have a list with integers from 1565 till 1 and then finally we creating 1565 new

02:23.920 --> 02:31.510
columns with the for loop here and the column labels should be 1 week to week and so on and again here

02:31.540 --> 02:36.620
we calculate the rolling mean return.

02:36.710 --> 02:37.770
Let's have a look here.

02:37.790 --> 02:39.530
So this might take a while.

02:40.040 --> 02:48.080
So here we have our weekly data frame with um here on the right hand side the column 1 week and on the

02:48.080 --> 02:54.290
left hand side of the column one thousand five hundred sixty five weeks and still we have for the columns

02:54.290 --> 03:01.610
close and return our data frame and we can simply drop them and we save the resulting data frame and

03:01.610 --> 03:02.990
the variable triangular

03:05.960 --> 03:12.530
and finally we can create our plot slow here our seaborne heat map and let's have a look here

03:19.190 --> 03:26.240
so that's our return triangle with a high resolution or high definition and that pretty much looks like

03:26.270 --> 03:27.540
a weather radar.

03:27.980 --> 03:37.730
So here we can see the huge Harry Kane in the year 2000 and 2001 and also the huge Harry Kane in 2 8

03:37.730 --> 03:43.780
2 9 and the financial crisis and yes actually the combination of both hurricanes.

03:43.790 --> 03:51.530
So if your investment experienced both hurricanes then still you are in the negative numbers here and

03:51.530 --> 03:53.430
depending on the investment period.

03:53.450 --> 04:00.140
So we can see here with the short periods there are many isolated thunderstorms.

04:00.140 --> 04:06.980
So this is a pretty random year if your investment period is uh let's say one year or one and a half

04:06.980 --> 04:14.390
years then that's pretty much gambling if you end up with a gain or loss and by increasing the investment

04:14.390 --> 04:20.300
period the returns are getting a less volatile and better predictable actually.

04:20.300 --> 04:26.270
So for example here you are pretty much in the double digit area and here you are still influenced by

04:26.270 --> 04:32.250
the hurricanes of the year 2000 and 2008 2009.

04:32.330 --> 04:38.870
So that's a pretty informative year and with this we are finished with the return triangles and radars

04:39.470 --> 04:42.110
and I hope to see you also in the next video by.
